package com.ehouse;

import java.net.ServerSocket;
import java.net.Socket;

import com.ehouse.connection.PetitionManager;

public class ServerThread extends Thread {

	// private static String ip = null;
	private final static int port = 6969;

	public ServerThread() {
		super("ServerThread");
	}

	@SuppressWarnings("resource")
	@Override
	public void run() {
		try {
			ServerSocket server = new ServerSocket(port);
			System.out.println("Server Ready");
			while (true) {
				Socket clientSocket = server.accept();
				System.out.println("Client Connected");
				PetitionManager cm = new PetitionManager(clientSocket);
				new Thread(cm).start();
			}
		} catch (Exception ex) {
			System.out.println("An error occurred : the server main thread");
			ex.printStackTrace();
		}
	}

}
